/*
 * author      : 吴中勤 
 * date        : 2018/8/17
 * description : TODO
 */

package com.deepexi.adapter.converter.sap;

import com.deepexi.adapter.converter.sap.bp.SapAdapterMember;
import com.deepexi.adapter.converter.sap.order.SapAdapterOrder;
import com.deepexi.adapter.log.LogContext;
import org.springframework.stereotype.Component;

@Component
public class SapConverterContext {

    // 会员-bp 关系
    private ThreadLocal<SapAdapterMember> memberBP = ThreadLocal.withInitial(() -> null);

    // 订单关系
    private ThreadLocal<SapAdapterOrder> orderBP = ThreadLocal.withInitial(() -> null);

    // 日志记录
    private ThreadLocal<LogContext> logContext = ThreadLocal.withInitial(() -> new LogContext());

    public LogContext getLogContext() {
        return this.logContext.get();
    }

    public SapAdapterMember getMemberBP() {
        return memberBP.get();
    }

    public SapAdapterOrder getOrderBP() {
        return orderBP.get();
    }

    public void setMemberBP(SapAdapterMember sapAdapterMember) {
        this.memberBP.set(sapAdapterMember);
    }

    public void setOrderBP(SapAdapterOrder sapAdapterOrder) {
        this.orderBP.set(sapAdapterOrder);
    }
}
